package org.andes.kownledge.operator.executable;

import java.util.ArrayList;
import java.util.List;

import org.andes.kownledge.operator.Executable;
import org.andes.kownledge.operator.Term;
import org.andes.sgg.st;

public class AddToWm extends Executable {
	
//	;;; Should have the form (add-to-wm <expression>) Can't fail, so it
//	;;; just adds a ground version of the expression to working memory in
//	;;; the given state.
//
//	(defun execute-add-to-wm (Ex State)
//	  "Implements the add-to-wm executable precondition"
//	  (push-wm (subst-bindings (st-Bindings State) (second Ex))
//		   State)
//	  (list State))
	@Override
	public List<st> exec(st state) {
		state.addWme(term.substBindings(state.getBindings()));
		List<st> result=new ArrayList<st>();
		result.add(state);
		return result;
	}

	Term term;
	public void setTerm(Term term){
		this.term=term;
	}
}
